package scenes
{
	import com.bluediesel.utils.managers.scenemanager.commands.*;
	import com.bluediesel.utils.managers.scenemanager.commands.events.*;
	import com.bluediesel.utils.managers.scenemanager.commands.greensock.*;
	import com.bluediesel.utils.managers.scenemanager.scenes.*;

	import fl.transitions.easing.Strong;
	import flash.events.MouseEvent;
	import flash.media.*;
	
	
	public class Scene03 extends AbstractScene implements IScene
	{
		public function Scene03(c:Object)
		{
			super(c);
		}
		
		override public function createIntroCommand():Command
		{
			return new SerialCommand(0,
				new TweenMaxTo( c.pigTitle, 0.2, { autoAlpha:1 } ),
				new TweenMaxTo( c.pigMC, 0.2, { autoAlpha:1 } ),
				new TweenMaxTo	( c.bodyCopyBG, 0.2, { height:231, width:470, autoAlpha:1, easing:Strong.easeOut } ),
				new TweenMaxTo( c.pigBodyCopy, 0.2, { autoAlpha:1 } ),
				new AddEventListener( c.pigMC, MouseEvent.MOUSE_DOWN, playNoise ),
				new AddEventListener( c.buttonPrevious, MouseEvent.MOUSE_DOWN, handlePrevious )
			);
		}
		
		override public function createOutroCommand():Command
		{
			return new SerialCommand(0,
				new RemoveEventListener( c.pigMC, MouseEvent.MOUSE_DOWN, playNoise ),
				new RemoveEventListener( c.buttonPrevious, MouseEvent.MOUSE_DOWN, handlePrevious ),
				new TweenMaxTo( c.pigBodyCopy, 0.1, { autoAlpha:0 } ),
				new TweenMaxTo( c.bodyCopyBG, 0.1, { height:0, width:0, autoAlpha:0, easing:Strong.easeOut } ),
				new TweenMaxTo( c.pigMC, 0.1, { autoAlpha:0 } ),
				new TweenMaxTo( c.pigTitle, 0.1, { autoAlpha:0 } )
			);
		}
		
		/* CUSTOM METHODS */
		private function handlePrevious(e:MouseEvent):void
		{
			sceneManager.setScene( new Scene02 ( c ) );
		}

		private function playNoise(e:MouseEvent):void{
			var soundChannel:SoundChannel = new SoundChannel();
			soundChannel = new PigNoise().play();
		}
		/* END CUSTOM METHODS */
	}
}